import { createStore, applyMiddleware } from 'redux';
import createSagaMiddleware from 'redux-saga';
import reducers from './reducers';
import runSagas from './sagas';

export default function(initState) {
	const sagaMiddleware = createSagaMiddleware();
	const Store = createStore(reducers, initState, applyMiddleware(sagaMiddleware));

	runSagas.call(sagaMiddleware);
	return Store;
}